<?php


class Auth{
	
	private
	$_user,
	$_pass,
	$_secret;
	
	public function __construct($user, $pass){
		$this->_setCredentials($user, $pass)->_setSecret();
	}
	
	private function login($user, $password){
		
	}
	
	public function _getUser(){
		$user = new ModelUser();
		try{
			$rs = $user->select()->where('secret = '."'$this->_secret'")->finish();
			if(empty($rs)){
				throw new Exception();
			}
			else{
				return $rs;
			}
			
		}
		catch(Exception $e){
			return false;
		}
	}
	
	private function _setSecret(){
		$this->_secret = md5($this->_user.$this->_pass);
		return $this;
	}
	
	private function _setCredentials($user, $pass){
		$this->_user = $user;
		$this->_pass = $pass;
		return $this;
	}
	
}